package com.ruoyi.neusoft.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.neusoft.domain.AiIdentifyPublishHisT;
import com.ruoyi.neusoft.service.IAiIdentifyPublishHisTService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 智能AI区域发布版本历史Controller
 * 
 * @author AI
 * @date 2023-12-06
 */
@Controller
@RequestMapping("/AI/PublishHisService")
public class AiIdentifyPublishHisTController extends BaseController
{
    private String prefix = "AI/PublishHisService";

    @Autowired
    private IAiIdentifyPublishHisTService aiIdentifyPublishHisTService;

    @RequiresPermissions("AI:PublishHisService:view")
    @GetMapping()
    public String PublishHisService()
    {
        return prefix + "/PublishHisService";
    }

    /**
     * 查询智能AI区域发布版本历史列表
     */
    @RequiresPermissions("AI:PublishHisService:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(AiIdentifyPublishHisT aiIdentifyPublishHisT)
    {
        startPage();
        List<AiIdentifyPublishHisT> list = aiIdentifyPublishHisTService.selectAiIdentifyPublishHisTList(aiIdentifyPublishHisT);
        return getDataTable(list);
    }

    /**
     * 导出智能AI区域发布版本历史列表
     */
    @RequiresPermissions("AI:PublishHisService:export")
    @Log(title = "智能AI区域发布版本历史", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(AiIdentifyPublishHisT aiIdentifyPublishHisT)
    {
        List<AiIdentifyPublishHisT> list = aiIdentifyPublishHisTService.selectAiIdentifyPublishHisTList(aiIdentifyPublishHisT);
        ExcelUtil<AiIdentifyPublishHisT> util = new ExcelUtil<AiIdentifyPublishHisT>(AiIdentifyPublishHisT.class);
        return util.exportExcel(list, "智能AI区域发布版本历史数据");
    }

    /**
     * 新增智能AI区域发布版本历史
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存智能AI区域发布版本历史
     */
    @RequiresPermissions("AI:PublishHisService:add")
    @Log(title = "智能AI区域发布版本历史", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(AiIdentifyPublishHisT aiIdentifyPublishHisT)
    {
        return toAjax(aiIdentifyPublishHisTService.insertAiIdentifyPublishHisT(aiIdentifyPublishHisT));
    }

    /**
     * 修改智能AI区域发布版本历史
     */
    @RequiresPermissions("AI:PublishHisService:edit")
    @GetMapping("/edit/{uuid}")
    public String edit(@PathVariable("uuid") Long uuid, ModelMap mmap)
    {
        AiIdentifyPublishHisT aiIdentifyPublishHisT = aiIdentifyPublishHisTService.selectAiIdentifyPublishHisTByUuid(uuid);
        mmap.put("aiIdentifyPublishHisT", aiIdentifyPublishHisT);
        return prefix + "/edit";
    }

    /**
     * 修改保存智能AI区域发布版本历史
     */
    @RequiresPermissions("AI:PublishHisService:edit")
    @Log(title = "智能AI区域发布版本历史", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(AiIdentifyPublishHisT aiIdentifyPublishHisT)
    {
        return toAjax(aiIdentifyPublishHisTService.updateAiIdentifyPublishHisT(aiIdentifyPublishHisT));
    }

    /**
     * 删除智能AI区域发布版本历史
     */
    @RequiresPermissions("AI:PublishHisService:remove")
    @Log(title = "智能AI区域发布版本历史", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(aiIdentifyPublishHisTService.deleteAiIdentifyPublishHisTByUuids(ids));
    }
}
